package com.foxchen.offline.task.bean;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
public class ResponseBean<T> {
    private T data;
    private String msg;
    private Integer code;

    public static <T> ResponseBean<T> success(T data){
        ResponseBean<T> responseBean = new ResponseBean<>();
        responseBean.setCode(0);
        responseBean.setData(data);

        return responseBean;
    }

    public static <T> ResponseBean<T> error(String errorMsg){
        ResponseBean<T> responseBean = new ResponseBean<>();
        responseBean.setCode(-1);
        responseBean.setMsg(errorMsg);

        return responseBean;
    }
}
